/* Copyright (C) 2010 Fredrique Samuels, fredriquesamuels@gmail.com */

/*
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef TEST_MATRIX_H_
#define TEST_MATRIX_H_


#include <time.h>

#include "testcase.h"
#include "../src/matrix.h"


class test_matrix : public testcase {
public:
	test_matrix() :
		testcase() {};
	virtual ~test_matrix() {};

	inline virtual void run_tests() {
		cout<<"\n*********************************"<<endl;
		cout<<"*"<<endl;
		cout<<"* Running Matrix Tests"<<endl;
		cout<<"*"<<endl;
		cout<<"*********************************"<<endl;
		testMatrix();
	}
	
	inline void assertValue(tri::matrix* m,float* v){
		for (int i=0;i<16;i++){
			assert(m->elements[i] == v[i]);
		}
	}

	inline void testMatrix() {
		
		tri::matrix m; 
		cout<<"testing load identity ...."<<endl;
		
		float identity[] = {1.0,0,0,0,
				            0,1.0,0,0,
				            0,0,1.0,0,
				            0,0,0,1.0};
		assertValue(&m,identity);
		
		float rotX[] = {1, 0 ,0 ,0, 0, 1, 1, -0, 0, 0, 1, 0, 0, 0, 0, 1};
		tri::matrix::get_rotation_matrixX(0,&m);
		assertValue(&m,rotX);
		
	}
	

};

#endif /*TEST_ANIMATION_H_*/
